import React, { useState } from 'react'
import PubSub from 'pubsub-js'
export default function Gege() {
  const [car, setCar] = useState("八手奥迪")
  const changeCarHandle = () => {
    setCar("一手雅迪");
    //当换车以后发布数据
    PubSub.publish("qiche", "一手雅迪")
  }
  return (
    <div>
      <h1>我是哥哥 我开的{car}</h1>
      <button onClick={changeCarHandle}>换车</button>
    </div>
  )
}
